package cn.bs.busuo.account.dao.persist.repository.impl;

import cn.bs.busuo.account.dao.persist.mapper.FriendMapper;
import cn.bs.busuo.account.dao.persist.repository.IFriendRepository;
import cn.bs.busuo.account.pojo.entity.Friends;
import cn.bs.busuo.account.pojo.vo.FriendsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class FriendRepositoryImpl implements IFriendRepository {
    @Autowired
    private FriendMapper friendMapper;

    @Override
    public int addNewFriend(Friends friends) {
        return friendMapper.insert(friends);
    }

    @Override
    public int deleteFriend(Long userId, Long id) {
        return friendMapper.deleteByUserIdAndFriendId(userId,id);
    }

    @Override
    public int selectFriendIfExits(Long userId, Long id) {
        return friendMapper.selectFriendIfExits(userId,id);
    }

    @Override
    public List<FriendsVO> listFriend(Long userId) {
        return friendMapper.listFriend(userId);
    }

}
